home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-24 | 4.1 KB | 159 lines | [TEXT/CWIE] |
- // ===========================================================================
- // <PP Starter Source>.cp ©1994-1995 Metrowerks Inc. All rights reserved.
- // ===========================================================================
- //
- // This file contains the starter code for a PowerPlant application
-
- #include "LG_main.h"
-
- #include <LGrowZone.h>
- #include <LWindow.h>
- #include <PP_Messages.h>
- #include <PP_Resources.h>
- #include <PPobClasses.h>
- #include <UDrawingState.h>
- #include <UMemoryMgr.h>
- #include <URegistrar.h>
- #include <LEditField.h>
-
- #include "CLGCommander.h"
- #include "CLG_CharsGrid.h"
- #include "CLG_CharInfo.h"
- #include "CLG_AnimBanner.h"
-
-
-
-
- // ===========================================================================
- // • Main Program
- // ===========================================================================
-
- void main(void)
- {
- // Set Debugging options
- SetDebugThrow_(debugAction_Alert);
- SetDebugSignal_(debugAction_Alert);
-
- InitializeHeap(3); // Initialize Memory Manager
- // Parameter is number of Master Pointer
- // blocks to allocate
-
- // Initialize standard Toolbox managers
- UQDGlobals::InitializeToolbox(&qd);
-
- new LGrowZone(20000); // Install a GrowZone function to catch
- // low memory situations.
-
- LGApp theApp; // replace this with your App type
- theApp.Run();
- }
-
-
- // ---------------------------------------------------------------------------
- // • LGApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Constructor
-
- LGApp::LGApp()
- {
- // Register functions to create core PowerPlant classes
-
- RegisterAllPPClasses();
-
- URegistrar::RegisterClass(CLG_CharsGrid::class_ID, (ClassCreatorFunc)CLG_CharsGrid::CreateDisplayStream);
- URegistrar::RegisterClass(CLG_CharInfo::class_ID, (ClassCreatorFunc)CLG_CharInfo::CreateDisplayStream);
- URegistrar::RegisterClass(CLG_AnimBanner::class_ID, (ClassCreatorFunc)CLG_AnimBanner::CreateDisplayStream);
-
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~LGApp // replace this with your App type
- // ---------------------------------------------------------------------------
- // Destructor
- //
-
- LGApp::~LGApp()
- {
- }
-
- // ---------------------------------------------------------------------------
- // • StartUp
- // ---------------------------------------------------------------------------
- // This function lets you do something when the application starts up.
- // For example, you could issue your own new command, or respond to a system
- // oDoc (open document) event.
-
- void
- LGApp::StartUp()
- {
- // set FontForce false and leave it false
- SetScriptManagerVariable( smFontForce, false);
-
- //ObeyCommand(cmd_New, nil); // EXAMPLE, create a new window
- mCmdr = new CLGCommander( this);
- mCmdr->CreateWindow();
-
- }
-
- // ---------------------------------------------------------------------------
- // • ObeyCommand
- // ---------------------------------------------------------------------------
- // Respond to commands
-
- Boolean
- LGApp::ObeyCommand(
- CommandT inCommand,
- void *ioParam)
- {
- Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- // Deal with command messages (defined in PP_Messages.h).
- // Any that you don't handle will be passed to LApplication
-
- case cmd_New:
- break;
-
- default:
- cmdHandled = LApplication::ObeyCommand(inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- // ---------------------------------------------------------------------------
- // • FindCommandStatus
- // ---------------------------------------------------------------------------
- // This function enables menu commands.
- //
-
- void
- LGApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
-
- switch (inCommand) {
-
- // Return menu item status according to command messages.
- // Any that you don't handle will be passed to LApplication
-
- case cmd_Close: // EXAMPLE
- case cmd_New: // EXAMPLE
- outEnabled = false; // enable the New command
- break;
-
-
- default:
- LApplication::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-